#!/usr/bin/env python
# -*- encoding: UTF-8 -*-
from __future__ import print_function,division
import argparse

import cv2
import numpy as np

def checkerboard(p,w,h):
    width = (w+1)*p
    higth = (h+1)*p
    img = np.zeros((higth,width),dtype=np.uint8)
    for y in xrange(higth):
        delta = (y//p) % 2
        for x in xrange(width):
            if (x//p + delta) % 2 == 0:
                img[y,x] = 255
    cv2.imwrite("chessboard.jpg",img)

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("--w", type=int, default=9,
                        help="ChessBoard Width")
    parser.add_argument("--h", type=int, default=4,
                        help=u"ChessBoard Height")
    args = parser.parse_args()
    checkerboard(50,args.w, args.h)